﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataModel;

namespace BasicDataManagement
{
    public interface IOpertation
    {
        //创建
        void CreateCategory(ObjectType type, string catName);
        void CreateObject(ObjectType type, object newObj);

        //获取分类
        List<string> LoadMaterialCategory();
        List<string> LoadOptionCategory();
        List<string> LoadComboCategory();
        List<string> LoadFixedDishCategory();
        List<string> LoadReplaceableDishCategory();

        //获取单项名
        List<string> LoadMateriaclItemName();
        List<string> LoadMateriaclItemName(string categoryName);

        List<string> LoadOptionItemName();
        List<string> LoadOptionItemName(string categoryName);

        List<string> LoadComboItemName();
        List<string> LoadComboItemName(string categoryName);

        List<string> LoadFixedDishItemName();
        List<string> LoadFixedDishItemName(string categoryName);

        List<string> LoadReplaceableDishItemName();
        List<string> LoadReplaceableDishItemName(string categoryName);

        /// <summary>
        /// 获取指定自选菜的可选菜名列表
        /// </summary>
        /// <param name="rDishName">自选菜名</param>
        /// <returns>可选菜名列表</returns>
        List<string> LoadReplaceableDishItemOptionNames(string rDishName);

        /// <summary>
        /// 获取指定套餐的组成部分名列表
        /// </summary>
        /// <param name="comboName">套餐名</param>
        /// <returns>组成部分名列表</returns>
        List<string> LoadComboItemComponentNames(string comboName);

        /// <summary>
        /// 获取指定套餐的指定部分下的可选单品名列表
        /// </summary>
        /// <param name="comboName">套餐名</param>
        /// <param name="componentName">组成部分名</param>
        /// <returns>可选单品名列表</returns>
        List<string> LoadComboItemComponentIngredientNames(string comboName, string componentName);

        //获取单项对象列表
        List<MaterialObject> LoadMaterialObjects();
        List<MaterialObject> LoadMaterialObjects(string categoryName);

        List<FixedDishObject> LoadFixedDishObjects();
        List<FixedDishObject> LoadFixedDishObjects(string categoryName);

        List<ComboObject> LoadComboObjects();
        List<ComboObject> LoadComboObjects(string categoryName);

        List<OptionObject> LoadOptionObjects();
        List<OptionObject> LoadOptionObjects(string categoryName);

        List<ReplaceableDishObject> LoadReplaceableDishObjects();
        List<ReplaceableDishObject> LoadReplaceableDishObjects(string categoryName);

        //获取单项的SimpleObject（名+统计单位+ID+...）
        List<IngredientSimpleObject> LoadMaterialSimpleObjects();
        List<IngredientSimpleObject> LoadOptionSimpleObjects();
        List<IngredientSimpleObject> LoadFixedDishSimpleObjects();
        List<IngredientSimpleObject> LoadReplaceableDishSimpleObjects();
        List<IngredientSimpleObject> LoadComboSimpleObjects();

        //添加账单
        int AddBill(List<BillItem> billItemList, int logid, decimal discount, string eatPlace, string cashierIP);
        decimal LoadBillPrice(int billid);
        decimal LoadStaffLogPrice(int logid);
        int LoadStaffLogDealCount(int logid);
        //收银员增加余额(只增加实收的钱)
        void AddCashierMenoy(int logid,decimal menoy);

        //查询库存记录
        List<StockRecordItem> LoadMaterialStockRecordsAll();
        List<StockRecordItem> LoadMaterialStockRecordsCategory(string categoryName);
        List<StockRecordItem> LoadMaterialStockRecordsMaterial(string MaterialName);
        void AddMaterialStockRecord(StockRecordItem record);

        //更新数据
        void UpdateMaterial(string PreviousName, MaterialObject materialObj);
        void UpdateOption(string PreviousName, OptionObject optionObj);
        void UpdateFixedDish(string PreviousName, FixedDishObject fdObj);
        void UpdateCombo(string PreviousName, ComboObject comboObj);
        void UpdateReplaceableDish(string PreviousName, ReplaceableDishObject rdObj);
        void UpdateSubcatName(string catType, string previousName, string newName);

        //人员管理操作
        List<AuthorityGroup> LoadAuthorityGroups();
        List<string> LoadGroupNames();
        AuthorityGroup LoadAuthorityGroup(string groupName);
        List<StaffInfo> LoadStaffs();
        List<StaffInfo> LoadStaffs(string groupName);
        List<String> LoadStaffNames(string groupName);
        void AddAuthorityGroup(AuthorityGroup newGroup);
        void AddStaff(StaffInfo staff);
        void UpdateStaff(StaffInfo staff);
        void UpdateAuthorityGroup(AuthorityGroup group);
        void DeleteAuthorityGroup(AuthorityGroup group);
        void DeleteStaff(StaffInfo staff);

        SystemUser Login(string lognum, string pwd, string logip);
        DateTime LoadLoginTime(SystemUser user);
        void Logout(SystemUser user, string cashierip);
        AuthorityGroup LoadStaffGroup(string staffJobNum, string pwd);
        bool CheckUser(string staffJobNum, string pwd);
        int CheckLastLogout(string staffJobNum, string logip);
        SystemUser LoadLogRecord(int loginID);
        void DeleteLogoutRecord(string staffJobNum, string logip);

        //预约成品操作
        List<PreproduceObject> LoadPreproduceList();
        void UpdatePreproduceList(List<PreproduceObject> preproList);

        bool CheckMoneyVerify(string staffJobNum, string pwd);

        int AddKitchenDisplay(int billid, string display, string waitingCard);
        string LoadKitchenDisplay();
        void DeleteKitchenDisplay(int billid);

        //厨房数据操作
        int AddKitchenBill(int billid, string dishes, string waitingCard, string eatPlace);
        int AddKitchenBillItem(int billid, string dishName);
        void DeleteKitchenBill(int id);
        void DeleteKitchenBillItem(int itemID);
        List<string> LoadKitchenBill();
        List<string> LoadKitchenBillItem();
        //给取款
        void AddMoneyRecord(int logID, string takerJobNum, bool isTake, decimal value);


        //交班统计
        decimal LoadDiscount(int logID);
        decimal LoadGivenMoney(int logID);
        decimal LoadTakenMoney(int logID);

        List<HistoryBill> LoadHistoryBills(string cashierIP);

        //Membership
        void AddMemberType(string typeName);
        void RenameMemberType(string exName, string newName);
        List<string> LoadMemberType();

        void AddMember(string membername,string phonenumber,string sex,string birthday,string cardnumber,int membertype,string address,int score,float money,float giftmoney,float sumconsume);
        void EditMember(string membername, string phonenumber, string sex, string birthday, string cardnumber, int membertype, string address, int score, float money, float giftmoney, float sumconsume);

        //现金流向
        List<BillInfo> loadBillbyStaff(string jobNumber,DateTime today);
        List<int> loadBillIDbyStaff(string jobNumber, DateTime today);
        List<BillInfoItem> loadBillItembyStaff(string BillID);

        //给取流向
        List<MoneyRecordInfo> LoadMoneyRecordbyDate(DateTime today);
        List<CashierCashInfo> LoadCashierCash(DateTime today);
        decimal getBillPrice(int billid);

        //修改员工余额
        void UpdateStaffMenoy(string jobNumber, decimal money);

        //申请报销
        void AddReimbursement(string jobNumber,DateTime date,string project,decimal price,int number,decimal sum, string reason,int state);
        //查看我的报销记录
        List<Reimbursementinfo> LoadReimRecord(DateTime date, string jobNumber,bool isAll);
        //报销单处理——查看报销信息
        List<Reimbursementinfo> LoadStaffReimRecord(DateTime date, int state, bool isAll, string type);
        //批准所选报销单
        void UpdateStaffReimRecord(int[] id,string adminJobNumber);

        //盘点操作
        void AddCheckStockRecord(DateTime date,string name,string unit,float oldStock,float todayStock,float difference,int type,int id);
        List<CheckStock> LoadCheckStockRecord(DateTime date, int checkPro);


        List<StockRecordItem> LoadMaterialStockRecordsMaterial(string materialName,DateTime date);

        List<MaterialParent> LoadMaterialParent(int id,int type);

        //增加采购表
        void AddPurchaseTable(DateTime date, string name, string unit, float old, float nowWant, float nowPurchase);

        //查看我的采购报销记录
        List<Reimbursementinfo> LoadPurchaseRecord(DateTime date, string jobNumber, bool isAll);

        List<ForecastInfo> LoadFixedDishCount(DateTime date);
        List<ForecastInfo> LoadOptionCount(DateTime date);
        
    }
}
